/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Nico
 */
@Entity
@Table(name = "partido")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "EntityPartido.findAll", query = "SELECT e FROM EntityPartido e"),
    @NamedQuery(name = "EntityPartido.findById", query = "SELECT e FROM EntityPartido e WHERE e.id = :id"),
    @NamedQuery(name = "EntityPartido.findByFecha", query = "SELECT e FROM EntityPartido e WHERE e.fecha = :fecha"),
    @NamedQuery(name = "EntityPartido.findByHora", query = "SELECT e FROM EntityPartido e WHERE e.hora = :hora")})
public class EntityPartido implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Basic(optional = false)
    @Column(name = "hora")
    @Temporal(TemporalType.TIMESTAMP)
    private Date hora;
    @JoinColumn(name = "id_cancha", referencedColumnName = "id")
    @ManyToOne
    private EntityCancha idCancha;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "entityPartido")
    private Collection<EntityEquipoxpartido> entityEquipoxpartidoCollection;

    public EntityPartido() {
    }

    public EntityPartido(Integer id) {
        this.id = id;
    }

    public EntityPartido(Integer id, Date fecha, Date hora) {
        this.id = id;
        this.fecha = fecha;
        this.hora = hora;
    }
    public EntityPartido(Date fecha, Date hora) {
        this.fecha = fecha;
        this.hora = hora;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    public EntityCancha getIdCancha() {
        return idCancha;
    }

    public void setIdCancha(EntityCancha idCancha) {
        this.idCancha = idCancha;
    }

    @XmlTransient
    public Collection<EntityEquipoxpartido> getEntityEquipoxpartidoCollection() {
        return entityEquipoxpartidoCollection;
    }

    public void setEntityEquipoxpartidoCollection(Collection<EntityEquipoxpartido> entityEquipoxpartidoCollection) {
        this.entityEquipoxpartidoCollection = entityEquipoxpartidoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EntityPartido)) {
            return false;
        }
        EntityPartido other = (EntityPartido) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.EntityPartido[ id=" + id + " ]";
    }
    
}
